home *** CD-ROM | disk | FTP | other *** search
/ Cre@te Online 2000 December / Cre@teOnline CD05.iso / MacSoft / XML ConsoleMax.sea / XML ConsoleMax / Required / esc.jar / com / extensibility / esc / ESCDocument.class (.txt) < prev    next >
Encoding:
Java Class File  |  2000-06-30  |  15.0 KB  |  583 lines

  1. package com.extensibility.esc;
  2.  
  3. import com.extensibility.app.ApplicationPreferences;
  4. import com.extensibility.app.BaseApplication;
  5. import com.extensibility.app.BaseDocument;
  6. import com.extensibility.app.BasicURIResolver;
  7. import com.extensibility.app.Desktop;
  8. import com.extensibility.app.DialogFactory;
  9. import com.extensibility.app.UI;
  10. import com.extensibility.dom.AttrOwnerCache;
  11. import com.extensibility.dom.DOMUtilities;
  12. import com.extensibility.exv.ExtSchemaValidator;
  13. import com.extensibility.validation.Validator;
  14. import com.extensibility.validation.ValidatorError;
  15. import com.extensibility.validation.ValidatorErrorList;
  16. import com.extensibility.xml.ParserException;
  17. import com.extensibility.xml.SXE;
  18. import com.extensibility.xml.SchemaIntf;
  19. import com.extensibility.xml.URI;
  20. import com.ibm.xml.parsers.NonValidatingDOMParser;
  21. import java.awt.Cursor;
  22. import java.awt.event.ActionEvent;
  23. import java.io.File;
  24. import java.io.FileNotFoundException;
  25. import java.io.IOException;
  26. import java.io.InputStream;
  27. import java.io.Reader;
  28. import java.io.Writer;
  29. import java.net.MalformedURLException;
  30. import java.util.Date;
  31. import java.util.Enumeration;
  32. import java.util.Hashtable;
  33. import java.util.Vector;
  34. import javax.xml.parsers.DocumentBuilder;
  35. import javax.xml.parsers.DocumentBuilderFactory;
  36. import org.w3c.dom.Document;
  37. import org.xml.sax.EntityResolver;
  38. import org.xml.sax.InputSource;
  39. import org.xml.sax.SAXException;
  40. import org.xml.sax.SAXParseException;
  41.  
  42. public class ESCDocument extends BaseDocument implements EntityResolver {
  43.    public static final String ERROR = "error";
  44.    public static final String NAME = "name";
  45.    public static final String LOCATION = "location";
  46.    public static final String NODE = "node";
  47.    public static final String MESSAGE = "message";
  48.    public static final String FILE = "file";
  49.    public static final String ESC = "esc";
  50.    public static final String DATE = "date";
  51.    public static final String VALID = "valid";
  52.    public static final String VIRGIN = "virgin";
  53.    public static final String RECURSE = "recurse";
  54.    public static final String EXPANDED = "expanded";
  55.    public static final String USERSELECTED = "userSelected";
  56.    protected Hashtable files = new Hashtable();
  57.    protected ESCFileRepository repository = null;
  58.    private String supportedFlavors;
  59.    Hashtable resolvedEntities = new Hashtable();
  60.    BasicURIResolver bur = new BasicURIResolver();
  61.    protected NonValidatingDOMParser parser = new NonValidatingDOMParser();
  62.  
  63.    public ESCFile factoryESCFile(File var1, boolean var2) {
  64.       if (this.repository == null) {
  65.          this.repository = new ESCFileRepository();
  66.       }
  67.  
  68.       ESCFile var3 = this.repository.factoryESCFile(var1, var2);
  69.       if (!var3.isVirgin()) {
  70.          this.addFile(var3);
  71.       }
  72.  
  73.       return var3;
  74.    }
  75.  
  76.    public synchronized boolean checkValidatePerformed() {
  77.       Enumeration var1 = this.files.elements();
  78.  
  79.       while(var1.hasMoreElements()) {
  80.          if (!((ESCFile)var1.nextElement()).isVirgin()) {
  81.             return true;
  82.          }
  83.       }
  84.  
  85.       return false;
  86.    }
  87.  
  88.    public void addFile(ESCFile var1) {
  89.       String var2 = ((File)var1).getAbsolutePath();
  90.       if (!this.files.containsKey(var2)) {
  91.          this.files.put(var2, var1);
  92.       }
  93.  
  94.    }
  95.  
  96.    public void deleteFiles(String[] var1) {
  97.       for(int var2 = 0; var2 < var1.length; ++var2) {
  98.          ESCFile var3 = this.factoryESCFile(new File(var1[var2]), true);
  99.          if (var3.isUserSelected()) {
  100.             if (((File)var3).isDirectory()) {
  101.                Enumeration var4 = this.getFiles().elements();
  102.  
  103.                while(var4 != null && var4.hasMoreElements()) {
  104.                   ESCFile var5 = (ESCFile)var4.nextElement();
  105.                   String var6 = ((File)var5).getAbsolutePath();
  106.                   String var7 = var6.substring(0, var6.lastIndexOf(File.separator));
  107.                   if (!var5.isUserSelected() && var7.equals(var1[var2]) && ((File)var5).isFile() || var6.equals(var1[var2]) && ((File)var5).isDirectory()) {
  108.                      this.deleteFile(var6);
  109.                   }
  110.                }
  111.             }
  112.  
  113.             this.deleteFile(var1[var2]);
  114.          }
  115.       }
  116.  
  117.    }
  118.  
  119.    public void deleteFile(String var1) {
  120.       if (this.files.containsKey(var1)) {
  121.          this.files.remove(var1);
  122.          ((BaseDocument)this).touch();
  123.       }
  124.  
  125.    }
  126.  
  127.    public void removeFile(String var1) {
  128.       this.deleteFile(var1);
  129.       this.repository.removeESCFile(new File(var1));
  130.    }
  131.  
  132.    public void deleteAll() {
  133.       this.files.clear();
  134.       ((BaseDocument)this).touch();
  135.    }
  136.  
  137.    public ESCFile getFile(String var1) {
  138.       return (ESCFile)this.files.get(var1);
  139.    }
  140.  
  141.    public Hashtable getFiles() {
  142.       return this.files;
  143.    }
  144.  
  145.    public String getText() {
  146.       Enumeration var1 = this.files.elements();
  147.  
  148.       String var2;
  149.       ESCFile var3;
  150.       for(var2 = ""; var1.hasMoreElements(); var2 = String.valueOf(var2).concat(String.valueOf(String.valueOf(var3.toString()).concat(String.valueOf("\n"))))) {
  151.          var3 = (ESCFile)var1.nextElement();
  152.       }
  153.  
  154.       return var2;
  155.    }
  156.  
  157.    public ESCDocument(URI var1) {
  158.       super(var1);
  159.    }
  160.  
  161.    public ESCDocument() {
  162.       this.repository = new ESCFileRepository();
  163.    }
  164.  
  165.    public void write(Writer var1) throws IOException {
  166.       SXE var2 = new SXE(var1);
  167.       var2.writeHeader("1.0");
  168.       var2.writeElem("esc", 0);
  169.       Enumeration var3 = this.files.elements();
  170.  
  171.       while(var3.hasMoreElements()) {
  172.          ESCFile var4 = (ESCFile)var3.nextElement();
  173.          this.writeFile(var2, var4, 0);
  174.       }
  175.  
  176.       var2.flush();
  177.    }
  178.  
  179.    public void write(Writer var1, boolean var2) throws IOException {
  180.       SXE var3 = new SXE(var1);
  181.       var3.writeHeader("1.0");
  182.       var3.writeElem("esc", 0);
  183.       Enumeration var4 = this.files.elements();
  184.  
  185.       while(var4.hasMoreElements()) {
  186.          ESCFile var5 = (ESCFile)var4.nextElement();
  187.          if (var2 == var5.isValid()) {
  188.             this.writeFile(var3, var5, 0);
  189.          }
  190.       }
  191.  
  192.       var3.flush();
  193.    }
  194.  
  195.    private void writeFile(SXE var1, ESCFile var2, int var3) {
  196.       var1.writeElem("file", var3 + 1);
  197.       var1.writeAttr("name", ((File)var2).getAbsolutePath());
  198.       var1.writeAttr("valid", String.valueOf(var2.isValid()));
  199.       var1.writeAttr("virgin", String.valueOf(var2.isVirgin()));
  200.       var1.writeAttr("userSelected", String.valueOf(var2.isUserSelected()));
  201.       var1.writeAttr("date", var2.getValidationDate().toString());
  202.       if (((File)var2).exists() && ((File)var2).isFile()) {
  203.          Enumeration var4 = var2.getErrors().elements();
  204.  
  205.          while(var4.hasMoreElements()) {
  206.             ParserException var5 = (ParserException)var4.nextElement();
  207.             var1.writeElem("error", var3 + 2);
  208.             var1.writeElem("location", var3 + 3);
  209.             if (var5.getOffender() != null && var5.getOffender().length() > 0) {
  210.                var1.writeRawText(var5.getSourceLinePos() > 0 ? String.valueOf(var5.getSourceLinePos()).concat(String.valueOf(" ")) : var5.getOffender());
  211.             } else {
  212.                var1.writeText(Integer.toString(var5.getSourceLinePos()));
  213.             }
  214.  
  215.             var1.writeElem("message", var3 + 3);
  216.             var1.writeRawText(String.valueOf(String.valueOf("<![CDATA[ ").concat(String.valueOf(var5.getMessage()))).concat(String.valueOf("]]>")));
  217.          }
  218.       } else if (((File)var2).exists()) {
  219.          var1.writeElem("recurse", var3 + 2);
  220.          var1.writeText(String.valueOf(var2.isRecursive()));
  221.          var1.writeElem("expanded", var3 + 2);
  222.          var1.writeText(String.valueOf(var2.isExpanded()));
  223.       }
  224.  
  225.    }
  226.  
  227.    public void read(URI var1) {
  228.       try {
  229.          Reader var2 = var1.createReader();
  230.          ESCDocHandler var3 = new ESCDocHandler(this);
  231.          var3.parse(var2);
  232.       } catch (Exception var4) {
  233.          System.out.println("exception creating read in ESCDocument ");
  234.          ((Throwable)var4).printStackTrace();
  235.       }
  236.  
  237.    }
  238.  
  239.    public int getSize() {
  240.       return this.files != null ? this.files.size() : 0;
  241.    }
  242.  
  243.    public boolean save(ActionEvent var1) {
  244.       boolean var2 = super.save(var1);
  245.       if (var2) {
  246.          this.updateTheRootName();
  247.       }
  248.  
  249.       return var2;
  250.    }
  251.  
  252.    public boolean saveAs(ActionEvent var1) {
  253.       boolean var2 = super.saveAs(var1);
  254.       if (var2) {
  255.          this.updateTheRootName();
  256.       }
  257.  
  258.       return var2;
  259.    }
  260.  
  261.    protected File getSaveAsFile(ActionEvent var1) {
  262.       String[] var2 = new String[]{"esc"};
  263.       String var3 = "";
  264.       BaseApplication.getApplication();
  265.       ApplicationPreferences var4 = BaseApplication.getPreferences();
  266.       String var5 = (String)((Hashtable)var4).get("last_esc_dir");
  267.       if (var5 == null) {
  268.          var5 = File.separator;
  269.       }
  270.  
  271.       File var6 = DialogFactory.askNewFile(Desktop.getDialogParent(var1), var2, var3, var5);
  272.       if (var6 != null) {
  273.          ((Hashtable)var4).put("last_esc_dir", var6.getPath().toString());
  274.       }
  275.  
  276.       return var6;
  277.    }
  278.  
  279.    public void validateFiles(AWProgressBar var1, String[] var2) {
  280.       for(int var3 = 0; var3 < var2.length; ++var3) {
  281.          ESCFile var4 = this.factoryESCFile(new File(var2[var3]), false);
  282.          if (((File)var4).isDirectory()) {
  283.             Enumeration var5 = this.getSubfiles(var4, var4.isRecursive()).elements();
  284.  
  285.             while(var5 != null && var5.hasMoreElements()) {
  286.                this.validateFile(var1, (ESCFile)var5.nextElement());
  287.             }
  288.          } else if (((File)var4).exists()) {
  289.             this.validateFile(var1, var4);
  290.          }
  291.       }
  292.  
  293.    }
  294.  
  295.    public int getFileCount(boolean var1, String[] var2) {
  296.       int var3 = 0;
  297.  
  298.       for(int var4 = 0; var4 < var2.length; ++var4) {
  299.          ESCFile var5 = this.factoryESCFile(new File(var2[var4]), true);
  300.          if (var5 != null && ((File)var5).exists() && (!var1 || !var5.isXMLFile())) {
  301.             if (((File)var5).isDirectory()) {
  302.                Hashtable var6 = this.getSubfiles(var5, var5.isRecursive());
  303.                if (var1) {
  304.                   Enumeration var7 = var6.elements();
  305.  
  306.                   while(var7.hasMoreElements()) {
  307.                      ESCFile var8 = (ESCFile)var7.nextElement();
  308.                      if (!var8.isXMLFile()) {
  309.                         ++var3;
  310.                      }
  311.                   }
  312.                } else {
  313.                   var3 += var6.size();
  314.                }
  315.             } else {
  316.                ++var3;
  317.             }
  318.          }
  319.       }
  320.  
  321.       return var3;
  322.    }
  323.  
  324.    public String[] getModifiedFiles(String[] var1) {
  325.       Vector var2 = new Vector(15);
  326.  
  327.       for(int var3 = 0; var3 < var1.length; ++var3) {
  328.          ESCFile var4 = this.factoryESCFile(new File(var1[var3]), true);
  329.          if (var4 != null && ((File)var4).exists()) {
  330.             if (((File)var4).isDirectory()) {
  331.                Hashtable var5 = this.getModifiedFilesForDir(var4, var4.isRecursive());
  332.                Enumeration var6 = var5.elements();
  333.  
  334.                while(var6.hasMoreElements()) {
  335.                   var2.addElement(var6.nextElement());
  336.                }
  337.             } else if (this.isModified(var4)) {
  338.                var2.addElement(var4);
  339.             }
  340.          }
  341.       }
  342.  
  343.       String[] var7 = new String[var2.size()];
  344.       Enumeration var8 = var2.elements();
  345.  
  346.       for(int var9 = 0; var8.hasMoreElements(); var7[var9++] = ((ESCFile)var8.nextElement()).getAbsolutePath()) {
  347.       }
  348.  
  349.       return var7;
  350.    }
  351.  
  352.    private synchronized ESCFile validateFile(AWProgressBar var1, ESCFile var2) {
  353.       if (var1 != null && var1.isAllowed()) {
  354.          var1.next(((File)var2).getAbsolutePath());
  355.       }
  356.  
  357.       if (var1 != null && var1.isAllowed() && var2.getExtension().equalsIgnoreCase("xml")) {
  358.          ValidatorErrorList var33 = new ValidatorErrorList();
  359.          boolean var34 = false;
  360.  
  361.          try {
  362.             URI var5 = new URI(var2);
  363.             this.bur.setBaseURI(var5);
  364.             this.bur.autoCheckUnresolved(3000);
  365.             this.bur.setSilent(true);
  366.             DocumentBuilderFactory var39 = DocumentBuilderFactory.newInstance();
  367.             var39.setValidating(false);
  368.             DocumentBuilder var7 = var39.newDocumentBuilder();
  369.             var7.setEntityResolver(this);
  370.             InputSource var8 = createInputSource(var5);
  371.             Document var9 = var7.parse(var8);
  372.             SchemaIntf var10 = DOMUtilities.getSchema(var9, var5);
  373.             Object[] var11 = DOMUtilities.getSchemaInfo(var9, var5);
  374.             URI var12 = (URI)var11[0];
  375.             if (var10 != null && var12 != null && var12.exists()) {
  376.                Validator var40 = new Validator(var10);
  377.                var33 = var40.validateDocument(var9, (AttrOwnerCache)null, this.bur);
  378.             } else {
  379.                ValidatorError var13 = new ValidatorError(1, 1, UI.getString("xml.validation.schema.not.found"));
  380.                var33.add(var13);
  381.             }
  382.          } catch (SAXParseException var26) {
  383.             ValidatorError var38 = new ValidatorError(var26.getLineNumber(), var26.getColumnNumber(), String.valueOf(UI.getString("xml.validation.sax.parse.exception")).concat(String.valueOf(((SAXException)var26).getMessage())));
  384.             var33.add(var38);
  385.          } catch (SAXException var27) {
  386.             ValidatorError var37 = new ValidatorError(1, 1, UI.getString("xml.validation.schema.not.found"));
  387.             var33.add(var37);
  388.          } catch (MalformedURLException var28) {
  389.             ValidatorError var36 = new ValidatorError(1, 1, UI.getString("xml.validation.schema.not.found"));
  390.             var33.add(var36);
  391.          } catch (FileNotFoundException var29) {
  392.             ValidatorError var6 = new ValidatorError(1, 1, UI.getString("xml.validation.schema.not.found"));
  393.             var33.add(var6);
  394.          } catch (Throwable var30) {
  395.             System.out.println(var30);
  396.             var30.printStackTrace();
  397.          } finally {
  398.             var34 = var33.size() <= 0;
  399.             var2.setValidationDate(new Date());
  400.             var2.setValid(var34);
  401.             var2.setVirgin(false);
  402.             if (!var34) {
  403.                if (var33 == null) {
  404.                   var2.setErrors((new Vector()).elements());
  405.                } else {
  406.                   Enumeration var16 = var33.errors();
  407.  
  408.                   Vector var17;
  409.                   ParserException var19;
  410.                   for(var17 = new Vector(); var16.hasMoreElements(); var17.addElement(var19)) {
  411.                      ValidatorError var18 = (ValidatorError)var16.nextElement();
  412.                      var19 = new ParserException(var18.getMessage(), "", var18.getErrorLine(), 0);
  413.                      if (var18.getErrorNode() != null) {
  414.                         if (var18.getErrorNode().getNodeType() == 3) {
  415.                            var19.setOffender(String.valueOf(String.valueOf(String.valueOf(String.valueOf(var18.getErrorNode().getParentNode().getNodeType()).concat(String.valueOf(":"))).concat(String.valueOf(var18.getErrorNode().getParentNode().getNodeName()))).concat(String.valueOf(": "))).concat(String.valueOf(var18.getErrorNode().getNodeValue())));
  416.                         } else {
  417.                            var19.setOffender(String.valueOf(String.valueOf(var18.getErrorNode().getNodeName()).concat(String.valueOf(": "))).concat(String.valueOf(var18.getErrorNode().getNodeValue())));
  418.                         }
  419.                      }
  420.                   }
  421.  
  422.                   var2.setErrors(var17);
  423.                }
  424.             } else {
  425.                var2.setErrors(new Vector());
  426.             }
  427.  
  428.             this.addFile(var2);
  429.             this.updateFile(var2);
  430.          }
  431.       } else if (var1 != null && var1.isAllowed()) {
  432.          ExtSchemaValidator var3 = new ExtSchemaValidator();
  433.          BaseApplication.getApplication();
  434.          var3.setSchemaPath(String.valueOf(String.valueOf(BaseApplication.getHomePath()).concat(String.valueOf(File.separator))).concat(String.valueOf("sox")));
  435.          URI var4 = new URI(var2);
  436.          var3.validate(var4, var4, (String)null);
  437.          var2.setValidationDate(new Date());
  438.          var2.setValid(var3.isValid());
  439.          var2.setVirgin(false);
  440.          if (!var3.isValid()) {
  441.             var2.setErrors(var3.getAllErrors());
  442.          } else {
  443.             var2.setErrors(new Vector());
  444.          }
  445.  
  446.          Object var32 = null;
  447.          this.addFile(var2);
  448.          this.updateFile(var2);
  449.       }
  450.  
  451.       return var2;
  452.    }
  453.  
  454.    private void updateFile(ESCFile var1) {
  455.       ESCFile var2 = (ESCFile)this.files.get(((File)var1).getAbsolutePath());
  456.       if (var2 == null) {
  457.          this.files.put(((File)var1).getAbsolutePath(), var1);
  458.       } else {
  459.          var1.setUserSelected(var2.isUserSelected());
  460.          this.files.put(((File)var1).getAbsolutePath(), var1);
  461.       }
  462.  
  463.       ((BaseDocument)this).touch();
  464.    }
  465.  
  466.    public Hashtable getSubfiles(ESCFile var1, boolean var2) {
  467.       ESCWindow var3 = (ESCWindow)Desktop.getFrontDocWindow();
  468.       var3.setCursor(Cursor.getPredefinedCursor(3));
  469.       var3.setBlockCursor(true);
  470.       Hashtable var4 = this.getFilesForDirectory(var1, var2);
  471.       var3.setBlockCursor(false);
  472.       var3.setCursor(Cursor.getPredefinedCursor(0));
  473.       return var4;
  474.    }
  475.  
  476.    public Hashtable getFilesForDirectory(ESCFile var1, boolean var2) {
  477.       if (!((File)var1).isDirectory()) {
  478.          return new Hashtable();
  479.       } else {
  480.          Hashtable var3 = new Hashtable();
  481.          Enumeration var4 = FileHandler.list(var1, ESCApplication.getSupportedFlavors()).elements();
  482.  
  483.          while(var4 != null && var4.hasMoreElements()) {
  484.             ESCFile var5 = this.factoryESCFile((File)var4.nextElement(), true);
  485.             if (((File)var5).exists() && ((File)var5).isDirectory() && var2) {
  486.                Enumeration var6 = this.getFilesForDirectory(var5, var5.isRecursive()).elements();
  487.  
  488.                while(var6 != null && var6.hasMoreElements()) {
  489.                   ESCFile var7 = (ESCFile)var6.nextElement();
  490.                   var3.put(((File)var7).getAbsolutePath(), var7);
  491.                }
  492.             } else if (((File)var5).exists() && ((File)var5).isFile()) {
  493.                var3.put(((File)var5).getAbsolutePath(), var5);
  494.             }
  495.          }
  496.  
  497.          return var3;
  498.       }
  499.    }
  500.  
  501.    public Hashtable getModifiedFilesForDir(ESCFile var1, boolean var2) {
  502.       if (!((File)var1).isDirectory()) {
  503.          return new Hashtable();
  504.       } else {
  505.          Hashtable var3 = new Hashtable();
  506.          Enumeration var4 = FileHandler.list(var1, ESCApplication.getSupportedFlavors()).elements();
  507.  
  508.          while(var4 != null && var4.hasMoreElements()) {
  509.             ESCFile var5 = this.factoryESCFile((File)var4.nextElement(), true);
  510.             if (((File)var5).exists() && ((File)var5).isDirectory() && var2) {
  511.                Enumeration var6 = this.getModifiedFilesForDir(var5, var5.isRecursive()).elements();
  512.  
  513.                while(var6 != null && var6.hasMoreElements()) {
  514.                   ESCFile var7 = (ESCFile)var6.nextElement();
  515.                   var3.put(((File)var7).getAbsolutePath(), var7);
  516.                }
  517.             } else if (((File)var5).exists() && this.isModified(var5)) {
  518.                var3.put(((File)var5).getAbsolutePath(), var5);
  519.             }
  520.          }
  521.  
  522.          return var3;
  523.       }
  524.    }
  525.  
  526.    protected boolean isModified(ESCFile var1) {
  527.       File var2 = new File(((File)var1).getAbsolutePath());
  528.       Date var3 = new Date(var2.lastModified());
  529.       long var4 = var3.getTime();
  530.       Date var6 = var1.getValidationDate();
  531.       long var7 = var6.getTime();
  532.       return ((File)var1).exists() && ((File)var1).isFile() && (var1.isVirgin() || var4 > var7);
  533.    }
  534.  
  535.    private void updateTheRootName() {
  536.       ESCWindow var1 = (ESCWindow)BaseApplication.getApplication().getMainWindow(this);
  537.       var1.updateTheRootName(((BaseDocument)this).getName());
  538.    }
  539.  
  540.    public InputSource resolveEntity(String var1, String var2) throws IOException, SAXException {
  541.       URI var3 = new URI(var2);
  542.       this.bur.setSilent(true);
  543.       URI var4 = this.bur.resolve(var3);
  544.       if (var4 == null) {
  545.          var4 = URI.makeStringURI("");
  546.       }
  547.  
  548.       if (var4.getFullName().startsWith("file:////")) {
  549.          InputSource var6 = new InputSource();
  550.          var6.setSystemId(var4.getFullName());
  551.          var6.setCharacterStream(var4.createReader());
  552.          return var6;
  553.       } else if (var3 == var4) {
  554.          return null;
  555.       } else {
  556.          InputStream var5 = var4.createInputStream();
  557.          return new InputSource(var5);
  558.       }
  559.    }
  560.  
  561.    protected static InputSource createInputSource(URI var0) {
  562.       InputSource var1 = new InputSource();
  563.       if (!var0.hasPersistence()) {
  564.          if (var0.getBaseURI() != null) {
  565.             var1.setSystemId(var0.getBaseURI().getFullName());
  566.          }
  567.       } else {
  568.          var1.setSystemId(var0.getFullName());
  569.       }
  570.  
  571.       try {
  572.          var1.setCharacterStream(var0.createReader());
  573.       } catch (IOException var3) {
  574.       }
  575.  
  576.       return var1;
  577.    }
  578.  
  579.    public URI resolve(URI var1) {
  580.       return var1.exists() ? var1 : null;
  581.    }
  582. }
  583.